package com.marcocirillo.justweet;

public class testJusTweet {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	String foo = "hello!";
		char[] chars = foo.toCharArray();
		StringBuffer output = new StringBuffer();
		for(int i = 0; i < chars.length; i++){
		  output.append(Integer.toHexString((int)chars[i]));
		}
		System.out.println(output);
		
		String txtInHex = output.toString();
		byte [] txtInByte = new byte [txtInHex.length() / 2];
		int j = 0;
		for (int i = 0; i < txtInHex.length(); i += 2)
		{
			txtInByte[j++] = Byte.parseByte(txtInHex.substring(i, i + 2), 16);
		}
		String txt = new String(txtInByte);
		System.out.println(txt);

	}
}

